//////////////////////////////////////////////////////////////////////////////////
//	Copyright 2011 by Yosef Grabivker, ryuho@homenetworksoft.com
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
//////////////////////////////////////////////////////////////////////////////////

#include <wx/wx.h>
#include "def.h"
#include "guicommon.h"
#include "levelgraph.h"

CGuiCommon::CGuiCommon(void)
{
}

CGuiCommon::~CGuiCommon(void)
{
}

void CGuiCommon::AddTimeValues(wxComboBox* pComboBox, CLevelGraph* pGraph)
{
	wxString strM(_("minute"));
	wxString strMs(_("minutes"));
	wxString strH(_("hour"));
	wxString strHs(_("hours"));

	pComboBox->Append( wxString(wxT("1 "))+strM,	(void*)60		 );
	//pComboBox->Append( wxString(wxT("2 "))+strMs,	(void*)(2*60)     );
	pComboBox->Append( wxString(wxT("5 "))+strMs,	(void*)(5*60)     );
	pComboBox->Append( wxString(wxT("10 "))+strMs,	(void*)(10*60)    );
	pComboBox->Append( wxString(wxT("30 "))+strMs,	(void*)(30*60)    );
	pComboBox->Append( wxString(wxT("1 "))+strH,	(void*)(1*60*60)  );
	pComboBox->Append( wxString(wxT("4 "))+strHs,	(void*)(4*60*60)  );
	pComboBox->Append( wxString(wxT("8 "))+strHs,	(void*)(8*60*60)  );
	pComboBox->Append( wxString(wxT("12 "))+strHs,	(void*)(12*60*60) );
	pComboBox->Append( wxString(wxT("16 "))+strHs,	(void*)(16*60*60) );
	pComboBox->Append( wxString(wxT("20 "))+strHs,	(void*)(20*60*60) );
	pComboBox->Append( wxString(wxT("24 "))+strHs,	(void*)(24*60*60) );

	pComboBox->SetSelection(1);
	pGraph->SetTimePeriod(5*60);
}

wxBoxSizer* CGuiCommon::GraphicHeader(wxWindow* pParent, const wxString& strTitle, int id, CLevelGraph* pGraph )
{
	wxBoxSizer* pRightSizer = new wxBoxSizer(wxHORIZONTAL);
	int nFlagsLocal=wxLEFT|wxUP|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT;
	int nBorder=5;

	pRightSizer->Add(new wxStaticText(pParent, wxID_ANY, _("Time period:")), 0, nFlagsLocal, nBorder);

	wxComboBox* pComboBox = new wxComboBox(pParent, id, wxT(""), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxCB_READONLY );

	AddTimeValues(pComboBox, pGraph);

	pRightSizer->Add(pComboBox, 0, nFlagsLocal, 0);

	return pRightSizer;
}

wxBoxSizer* CGuiCommon::GraphicHeader(wxWindow* pParent, const wxString& strTitle, CLevelGraph* pGraph )
{
	wxBoxSizer* pRightSizer = new wxBoxSizer(wxHORIZONTAL);
	int nFlagsLocal=wxLEFT|wxUP|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT;
	int nBorder=5;


	return pRightSizer;
}
